package com.sx.core.mybatis;

import java.lang.reflect.Array;
import java.util.Collection;

/**
 * Created by lihao on 2017/7/9.
 */
public class Ognl {
    public static int size(Object para){
        if(para==null){
            return 0;
        }
        if(para instanceof Collection){
            Collection collection=(Collection)para;
            return collection.size();
        }else if(para.getClass().isArray()){
            return Array.getLength(para);
        }else if(para instanceof String){
            return ((String) para).length();
        }
        return 0;
    }

}
